import request from "@/utils/request";

// 查询模型训练任务列表
export function listTask(query) {
  return request({
    url: "/task/task/list",
    method: "get",
    params: query,
  });
}

// 查询模型训练任务详细
export function getTask(id) {
  return request({
    url: "/task/task/" + id,
    method: "get",
  });
}

// 新增模型训练任务
export function addTask(data) {
  return request({
    url: "/task/task",
    method: "post",
    data: data,
  });
}

// 修改模型训练任务
export function updateTask(data) {
  return request({
    url: "/task/task",
    method: "put",
    data: data,
  });
}

// 删除模型训练任务
export function delTask(id) {
  return request({
    url: "/task/task/" + id,
    method: "delete",
  });
}

// 开始训练
export function startTraining(id) {
  return request({
    url: "/task/task/start/" + id,
    method: "put",
  });
}

// 停止训练
export function stopTraining(id) {
  return request({
    url: "/task/task/stop/" + id,
    method: "put",
  });
}

// 下载训练结果文件
export function downloadResult(id) {
  return request({
    url: "/task/task/download/" + id,
    method: "get",
    responseType: "blob",
  });
}
